from random import *
import turtle as t

# 画圆形气球
def drawBalloon(balloonNum):
    t.colormode(255)
    for x in range(balloonNum):
        i = randint(-150, 150)
        j = randint(-150, 150)
        t.up()
        t.goto(i, j)
        t.down()
        r = randint(0, 255)
        g = randint(0, 255)
        b = randint(0, 255)
        t.color(r, g, b)
        t.begin_fill()
        t.circle(25)
        t.end_fill()
        t.right(90)
        t.color(15, 15, 15)
        t.fd(50)
        t.seth(0)

# 画心形气球
def drawHeart(balloonNum):
    for i in range(balloonNum):
        i = randint(-150, 150)
        j = randint(-150, 150)
        t.up()
        t.goto(i, j)
        t.down()
        r = randint(0, 255)
        g = randint(0, 255)
        b = randint(0, 255)
        t.color(r, g, b)
        t.begin_fill()
        t.lt(135)
        t.fd(40)
        t.right(180)  # 画笔掉头
        t.circle(15, -180)
        t.backward(8)
        t.right(90)
        t.forward(8)
        t.circle(-15, 180)
        t.fd(40)
        t.end_fill()
        t.left(45)
        t.color(15, 15, 15)
        t.fd(50)
        t.seth(0)
        t.hideturtle()

t.setup(800, 600, 0, 0)
drawBalloon(10)
drawHeart(5)
t.done()

